package com.levi.functionalinterface;

import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;

/**
 * @author shentong
 * @date 2022/1/10 10:04 PM
 * @description consumer接口主要用于获取数据,没有返回值
 */
public class MyConsumerDemo {

    public static void get(List<String> lanList, Consumer<String> consumer){
        //获取lanList中的每一个数据
        lanList.forEach(consumer);
    }

    public static void main(String[] args) {
        String[] lanuage = {"java","php","python","c","c++"};
        List<String> lanuageList = Arrays.asList(lanuage);
        get(lanuageList, System.out::println);
    }
}
